# -*- coding: utf-8 -*-
import os
import sys
from datetime import datetime

pwd = os.path.dirname(os.path.dirname(__file__))

# 进入django设置
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'shop.settings')

import django

django.setup()

from managements.models import MenuList, RoleList, ReturnAddress, SystemSet


def gen_role():
    role = RoleList()
    role.name = '订单管理员'
    role.desc = '只能查看及操作订单'
    role.is_display = 1
    role.add_time = datetime.now()

    role = RoleList()
    role.name = '商品管理员'
    role.desc = '只能查看及操作商品'
    role.is_display = 1
    role.add_time = datetime.now()

    role = RoleList()
    role.name = '营销管理员'
    role.desc = '只能查看及营销操作'
    role.is_display = 1
    role.add_time = datetime.now()

    role = RoleList()
    role.name = '系统管理员'
    role.desc = '拥有所有查看和操作功能'
    role.is_display = 1
    role.add_time = datetime.now()
    role.save()


def gen_address():
    address = ReturnAddress()
    address.name = ''
    address.phone = ''
    address.address = ''
    address.code = ''
    address.save()


def gen_system():
    system = SystemSet()
    system.commentOvertime = 21
    system.confirmOvertime = 7
    system.finishOvertime = 14
    system.exchangeRate = 1
    system.flashOrderOvertime = 30
    system.normalOrderOvertime = 120
    system.save()

# def gen_
if __name__ == '__main__':
    gen_role()
    gen_address()
    gen_system()
